package com.mew.lobby.message.response;

import com.mew.common.entity.config.Room;
import com.zebra.common.ZebraBaseMessage;
import io.netty.buffer.ByteBuf;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @Author King.Song
 * @Date 2020/12/4 0004
 **/
@Data
@ToString
@NoArgsConstructor
public class RoomInfoMessage extends ZebraBaseMessage<RoomInfoMessage> {

    private int id;
    private int gameId;
    private int roomType;  //1, 初级场, 2,中级场, 3,高级场, 4, 大师场
    private int minGoldNumber;  //进入最小金币
    private int sequenceNum;  //序号
    private String betArrays;  //押注数组
    private int unlockLv;  //解锁

    @Override
    public void write(ByteBuf b) {
        writeInt(b, this.id);

        writeInt(b, this.gameId);
        writeInt(b, this.roomType);
        writeInt(b, this.minGoldNumber);
        writeInt(b, this.sequenceNum);
        writeString(b,this.betArrays);
        writeInt(b, this.unlockLv);
    }

    @Override
    public RoomInfoMessage read(ByteBuf byteBuf) {
        return null;
    }

    public RoomInfoMessage buildData(Room room, String betArrays){
        this.id = room.getId();
        this.gameId = room.getGameId();
        this.roomType = room.getRoomType();
        this.minGoldNumber = room.getMinGoldNumber();
        this.betArrays = betArrays;
        this.unlockLv = room.getUnlockLv();
        return this;
    }


}
